-
Notifications
You must be signed in to change notification settings - Fork 5
feat: Add configuration provider interface #184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Resolved conflicts: - observability/src/index.ts: Combined ILogger exports with configuration exports - observability/src/utils/logging.ts: Merged setLogger/getLogger/resetLogger pattern with configuration provider support for DefaultLogger - tooling/src/McpToolServerConfigurationService.ts: Combined imports for IConfigurationProvider with Authorization and AgenticAuthenticationService - tooling/src/Utility.ts: Combined imports for IConfigurationProvider with ChannelAccount Updated tests to match merged implementation: - Removed createLogger factory tests (replaced by setLogger/getLogger/resetLogger) - Updated GetAgenticUserToken expectations to include scopes parameter Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The scopes parameter was added as required in main branch, which is a breaking change for existing consumers. This adds overloads to maintain backward compatibility: - 3-param signature (deprecated): Uses default MCP platform scope - 4-param signature: Explicit scopes for better control Existing code calling GetAgenticUserToken(auth, handler, ctx) will continue to work, but callers are encouraged to migrate to the explicit scopes overload for clarity. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…vider Added detailed JSDoc explaining: - The provider creates a single cached configuration instance - Default module-level providers are singletons - Two approaches for multi-tenant scenarios: 1. Dynamic override functions reading from async context (recommended) 2. Per-tenant provider instances when needed This clarifies that while the singleton pattern is used, multi-tenancy is still supported through function-based overrides that resolve at runtime. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Added documentation to AgenticTokenCacheInstance explaining it uses default configuration and when to create custom instances - Exported AgenticTokenCache class so consumers can create instances with custom IConfigurationProvider for multi-tenant scenarios - Added class-level documentation with usage example Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…onment utility functions
…onfigurations for LangChain and OpenAI
… utility imports and updating server listing logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request introduces a comprehensive hierarchical configuration provider pattern throughout the Agents365 SDK, replacing direct process.env access with configuration classes that support programmatic overrides and multi-tenant scenarios. The PR adds new configuration classes (RuntimeConfiguration, ToolingConfiguration, ObservabilityConfiguration) with default singleton providers, applies these patterns across runtime, tooling, and observability packages, and introduces extensive test coverage.
Changes:
- Introduces configuration provider pattern with base
RuntimeConfigurationclass and package-specific extensions - Adds comprehensive test coverage for all configuration classes and related functionality
- Deprecates direct environment variable access and legacy utility functions
- Updates ESLint rules to enforce configuration usage and prevent deprecated API usage
Reviewed changes
Copilot reviewed 70 out of 71 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
packages/agents-a365-runtime/src/configuration/* |
New configuration infrastructure with interfaces, base classes, and default providers |
packages/agents-a365-runtime/src/power-platform-api-discovery.ts |
Converts ClusterCategory from type alias to enum for better type safety |
packages/agents-a365-runtime/src/environment-utils.ts |
Deprecates utility functions and delegates to configuration classes where possible |
packages/agents-a365-runtime/src/agentic-authorization-service.ts |
Adds overload accepting explicit scopes parameter |
packages/agents-a365-tooling/src/configuration/* |
Tooling configuration extending runtime configuration |
packages/agents-a365-tooling/src/Utility.ts |
Deprecates URL construction methods in favor of service usage |
packages/agents-a365-tooling/src/McpToolServerConfigurationService.ts |
Refactored to use configuration provider |
packages/agents-a365-observability/src/configuration/* |
Observability configuration extending runtime configuration |
packages/agents-a365-observability/src/utils/logging.ts |
Updated to use configuration provider for dynamic log level resolution |
packages/agents-a365-observability/src/tracing/* |
Multiple tracing utilities updated to use configuration |
packages/agents-a365-observability-hosting/src/caching/AgenticTokenCache.ts |
Refactored to accept configuration provider |
packages/agents-a365-*-extensions-*/src/configuration/* |
Extension-specific configurations for OpenAI, LangChain, Claude tooling and observability |
tests/**/*.test.ts |
Comprehensive test coverage for all new configuration classes |
eslint.config.mjs |
New rules to enforce configuration usage and prevent deprecated API usage |
docs/*.md |
Documentation updates reflecting the new configuration pattern |
|
CHANGELOG.md is not updated. |
…ationImprovements # Conflicts: # pnpm-lock.yaml
packages/agents-a365-observability/src/configuration/ObservabilityConfiguration.ts
Show resolved
Hide resolved
…ub.com/microsoft/Agent365-nodejs into users/johanb/ConfigurationImprovements
e983d40
…ants Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 70 out of 71 changed files in this pull request and generated 11 comments.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
packages/agents-a365-observability/src/configuration/ObservabilityConfigurationOptions.ts
Outdated
Show resolved
Hide resolved
packages/agents-a365-runtime/src/configuration/RuntimeConfigurationOptions.ts
Outdated
Show resolved
Hide resolved
packages/agents-a365-observability/src/configuration/ObservabilityConfiguration.ts
Show resolved
Hide resolved
- Introduced PerRequestSpanProcessorConfiguration to encapsulate per-request export settings. - Removed per-request related properties from ObservabilityConfiguration. - Updated documentation to reflect changes in configuration structure. - Adjusted tests to validate new configuration class and removed obsolete tests. - Ensured backward compatibility by maintaining environment variable handling for per-request settings.
packages/agents-a365-observability/src/configuration/ObservabilityConfiguration.ts
Show resolved
Hide resolved
packages/agents-a365-observability/src/configuration/ObservabilityConfiguration.ts
Show resolved
Hide resolved
* feat: Add x-ms-agentid header (#183) Co-authored-by: Johan Broberg <johanb@microsoft.com> * set gen_ai.caller.agent.type (#187) Co-authored-by: jsl517 <pefan@microsoft.com> * fix: update @isaacs/brace-expansion to version 5.0.1 (#181) Co-authored-by: Johan Broberg <johanb@microsoft.com> * feat: Add configuration provider interface (#184) * Add PRD for configuration provider for Agent 365 SDK * Change to dynamic resolution for configuration settings * feat: Add configuration provider interface * Update lock file * fix: add backward-compatible overloads to GetAgenticUserToken The scopes parameter was added as required in main branch, which is a breaking change for existing consumers. This adds overloads to maintain backward compatibility: - 3-param signature (deprecated): Uses default MCP platform scope - 4-param signature: Explicit scopes for better control Existing code calling GetAgenticUserToken(auth, handler, ctx) will continue to work, but callers are encouraged to migrate to the explicit scopes overload for clarity. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * docs: clarify multi-tenant usage patterns for DefaultConfigurationProvider Added detailed JSDoc explaining: - The provider creates a single cached configuration instance - Default module-level providers are singletons - Two approaches for multi-tenant scenarios: 1. Dynamic override functions reading from async context (recommended) 2. Per-tenant provider instances when needed This clarifies that while the singleton pattern is used, multi-tenancy is still supported through function-based overrides that resolve at runtime. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * docs: clarify AgenticTokenCache singleton usage and export class - Added documentation to AgenticTokenCacheInstance explaining it uses default configuration and when to create custom instances - Exported AgenticTokenCache class so consumers can create instances with custom IConfigurationProvider for multi-tenant scenarios - Added class-level documentation with usage example Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * add utility methods for parsing environment variables in RuntimeConfiguration * add setLogger and resetLogger tests * docs: enhance JSDoc comments for RuntimeConfigurationOptions * docs: update deprecation notices and provide usage examples for environment utility functions * refactor: update McpToolRegistrationService to use ClaudeToolingConfiguration * refactor: update McpToolRegistrationService to use specific tooling configurations for LangChain and OpenAI * refactor: ensure undefined checks for tooling overrides in ToolingConfiguration * refactor: enhance ObservabilityConfiguration tests for environment variable handling * refactor: streamline McpToolRegistrationService by removing redundant utility imports and updating server listing logic * Address review feedback and discrepancies between documentation and code. * Address additional feedback; add missing tests, improve documentation * fix: add guardrails comment for PerRequestSpanProcessor default constants Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Johan Broberg <johanb@microsoft.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> * Initial plan * Fix test: Add event method to custom logger mocks --------- Co-authored-by: Johan Broberg <johan@pontemonti.net> Co-authored-by: Johan Broberg <johanb@microsoft.com> Co-authored-by: PengF <126631706+fpfp100@users.noreply.github.com> Co-authored-by: jsl517 <pefan@microsoft.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
* clean up * support event logs and add events for export. * Fix test failure after adding event method to ILogger interface (#186) * Initial plan * Fix test failure by adding event method to ILogger mocks - Updated all mock ILogger objects in custom-logger.test.ts to include the event method - Updated setLogger validation to check for event method - Updated error message to include event method in validation Co-authored-by: fpfp100 <126631706+fpfp100@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: fpfp100 <126631706+fpfp100@users.noreply.github.com> * comments * comments * comments * comment * doc update * Resolve merge conflicts with main branch (#188) * feat: Add x-ms-agentid header (#183) Co-authored-by: Johan Broberg <johanb@microsoft.com> * set gen_ai.caller.agent.type (#187) Co-authored-by: jsl517 <pefan@microsoft.com> * fix: update @isaacs/brace-expansion to version 5.0.1 (#181) Co-authored-by: Johan Broberg <johanb@microsoft.com> * feat: Add configuration provider interface (#184) * Add PRD for configuration provider for Agent 365 SDK * Change to dynamic resolution for configuration settings * feat: Add configuration provider interface * Update lock file * fix: add backward-compatible overloads to GetAgenticUserToken The scopes parameter was added as required in main branch, which is a breaking change for existing consumers. This adds overloads to maintain backward compatibility: - 3-param signature (deprecated): Uses default MCP platform scope - 4-param signature: Explicit scopes for better control Existing code calling GetAgenticUserToken(auth, handler, ctx) will continue to work, but callers are encouraged to migrate to the explicit scopes overload for clarity. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * docs: clarify multi-tenant usage patterns for DefaultConfigurationProvider Added detailed JSDoc explaining: - The provider creates a single cached configuration instance - Default module-level providers are singletons - Two approaches for multi-tenant scenarios: 1. Dynamic override functions reading from async context (recommended) 2. Per-tenant provider instances when needed This clarifies that while the singleton pattern is used, multi-tenancy is still supported through function-based overrides that resolve at runtime. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * docs: clarify AgenticTokenCache singleton usage and export class - Added documentation to AgenticTokenCacheInstance explaining it uses default configuration and when to create custom instances - Exported AgenticTokenCache class so consumers can create instances with custom IConfigurationProvider for multi-tenant scenarios - Added class-level documentation with usage example Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * add utility methods for parsing environment variables in RuntimeConfiguration * add setLogger and resetLogger tests * docs: enhance JSDoc comments for RuntimeConfigurationOptions * docs: update deprecation notices and provide usage examples for environment utility functions * refactor: update McpToolRegistrationService to use ClaudeToolingConfiguration * refactor: update McpToolRegistrationService to use specific tooling configurations for LangChain and OpenAI * refactor: ensure undefined checks for tooling overrides in ToolingConfiguration * refactor: enhance ObservabilityConfiguration tests for environment variable handling * refactor: streamline McpToolRegistrationService by removing redundant utility imports and updating server listing logic * Address review feedback and discrepancies between documentation and code. * Address additional feedback; add missing tests, improve documentation * fix: add guardrails comment for PerRequestSpanProcessor default constants Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Johan Broberg <johanb@microsoft.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> * Initial plan * Fix test: Add event method to custom logger mocks --------- Co-authored-by: Johan Broberg <johan@pontemonti.net> Co-authored-by: Johan Broberg <johanb@microsoft.com> Co-authored-by: PengF <126631706+fpfp100@users.noreply.github.com> Co-authored-by: jsl517 <pefan@microsoft.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> --------- Co-authored-by: jsl517 <pefan@microsoft.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: Johan Broberg <johan@pontemonti.net> Co-authored-by: Johan Broberg <johanb@microsoft.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This pull request introduces a hierarchical, provider-based configuration pattern throughout the Agents365 SDK, deprecating direct environment variable access and legacy utility functions. It adds new configuration classes and providers for runtime, tooling, and observability settings, and applies these patterns to both documentation and code. The changes also introduce OpenAI-specific observability configuration scaffolding, update linting rules to enforce the new configuration approach, and refactor token caching to use the new provider model.
Configuration System Overhaul
RuntimeConfiguration,ToolingConfiguration, andObservabilityConfiguration, each with default singleton providers (e.g.,defaultRuntimeConfigurationProvider). This enables hierarchical, function-based overrides for multi-tenant support and deprecates direct use of environment utilities. [1] [2] [3] [4]OpenAI Observability Extension
OpenAIObservabilityConfigurationand associated options/types, following the provider pattern for future extensibility and type safety. Exported a singleton provider (defaultOpenAIObservabilityConfigurationProvider) for this configuration. [1] [2] [3] [4]@microsoft/agents-a365-runtimein the OpenAI observability extension package.Agentic Token Cache Refactor
AgenticTokenCacheto accept anIConfigurationProvider<ObservabilityConfiguration>, defaulting todefaultObservabilityConfigurationProvider, enabling per-tenant configuration and improved testability. Exported both the class and a default singleton instance. [1] [2] [3] [4] [5]Linting and Code Quality
process.envaccess and to disallow deprecated API usage, with exceptions for configuration, test, and utility files. [1] [2]Documentation and Environment Variables
These changes collectively modernize the SDK’s configuration approach, improve extensibility and testability, and lay the groundwork for multi-tenant and advanced observability scenarios.